package homework1.server;

import homework1.utils.Tool;

import java.util.Scanner;

/**
 * 服务用户在服务器终端输入命令的进程
 *
 * @author jian
 * @date 2024/01/09 10:58
 **/
public class ServerOperationThread extends Thread{
    @Override
    public void run() {
        Scanner sc = new Scanner(System.in);
        while (true){
            System.out.println("输入命令以查看文件");
            String input = sc.nextLine();
            String[] params = input.split(" ");
            if (params.length == 2 && params[0].equals("show")){
                String filePath = Server.dirPath + params[1];
                if (Tool.fileIsExist(filePath)){
                    Tool.checkFile(filePath);
                }
            }
        }
    }
}
